package com.stefan.test;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;

public class Demo {
    public static void main(String[] args) {
        List<User> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            User user = new User(i,"stefan"+i);
            list.add(user);
        }
        List<User> collect = list.stream().sorted((a, b) -> {
            return a.getId() - b.getId();
        }).collect(Collectors.toList());
        collect.forEach( user -> {
            System.out.println("id: " + user.getId() + ", name: " + user.getName());
        });
        System.out.println(String.valueOf('a'));
    }
}
